package com.recursivechaos.examples.ebcdic;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;

public class MainEbcdicReader {

	public static void main(String[] args) {
		String inChar;
		InputStreamReader rdr = null;
		try
		{
			rdr = new InputStreamReader(new FileInputStream("testdata.dat"),java.nio.charset.Charset.forName("ibm500"));
			System.out.println(rdr.getEncoding());
			for(int l = 0; l < 10; l++){
				//do{
				for(int i = 0; i < 190; i++){
					inChar = Character.toString((char)rdr.read());
					System.out.print(inChar);
				}
				System.out.println();
				//}while(!inChar.equals("-1"));
			}

		}
		catch (Exception e)
		{
			e.printStackTrace();
		}
		finally
		{
			try {
				rdr.close();
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
	}

}
